<?php
	/**
	* 
	*/
	class Model_home extends CI_Model
	{
		
		function __construct()
		{
			parent::__construct();
			session_start();
		}

		function check_login($data)
		{
			$this->db->where('username='.$data['user']);
			$this->db->where('password='.$data['password']);
			$query = $this->db->get('user');
			if($query->num_rows() == 1)
			{
				foreach($query->result as $row)
				{
					$_SESSION['user'] = $row->username;
					$_SESSION['level'] = $row->level;
				}
			}
			else
			{
				$data[] = 'Wrong username or password!!';
			}
			return $data;
		}
	}
?>